﻿using blackhouse.BlackApart.Web;
using blackhouse.BlackApart.Web.Navigation;
using blackhouse.mojoPortalExtend;
using mojoPortal.Business;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace blackhouse.StareKino.Web.Navigation {
    public class SearchStateUrlVisitor : UrlVisitor, ISearchStateVisitor {

        public void Apply(SearchState search) {
            PageProvider pageProv = new PageProvider();
            PageSettings page = pageProv.FindCmsPageByFunctionality("apartments");
            if (page != null)
                this.Url = UrlUtils.LocalizeUrl(page.Url.ReplaceEx("~/", "/") + "?search=" + search.ToString());
            else
                this.Url = "page-not-found";
        }

    }
}